﻿<div ms-controller="LIST">
    <div class="btn-add">
        <button type="button" ms-if="datatype=='8'&&JHDATA.JHStatus=='0'" class="btn btn-success btn-lg" ms-click="jhzxmx()"><i class=" iconfont icon-bianji ft12 mr5"></i>支付</button>

    </div>

    <div class="tab-filter-type">
        <div class="oh">
            <h5 class="pull-left tr">类型：</h5>
            <ul class="tab-type ft14">
                <li ms-click="SelectDataType('8')"><span class="active">一览表已审核</span></li>
                <li ms-click="SelectDataType('9')"><span>已支付</span></li>
                <li ms-click="SelectDataType('4')"><span>已中止</span></li>
                    

            </ul>
        </div>
    </div>

    <div class="default-tab ft14 pt20 grid">

        <div id="jqxgrid" class="jqxgrid" style="border-right:0;border-left:0;"></div>

    </div>
</div>
<link rel="stylesheet" href="/ViewV5/JS/YanGrid/jqwidgets/styles/jqx.base.css" />
<link rel="stylesheet" href="/ViewV5/JS/YanGrid/jqwidgets/styles/jqx.office.css" />
<script src="/VIEWV5/JS/YanGrid/jqwidgets/jqgridall.js"></script>
<script>
    var goption = {
        columnsresize: true,
        columns: [

              {
                  text: '1', dataField: 'issel', columntype: 'checkbox', width: 40, editable: true, sortable: false, filterable: false, groupable: false, draggable: false, resizable: false,
                  renderer: function () {
                      return '<div style="margin-left: 10px; margin-top: 5px;"></div>';
                  },
                  rendered: function (element) {
                      $(element).jqxCheckBox({ theme: "office", width: 16, height: 16, animationShowDelay: 0, animationHideDelay: 0 });
                      // columnCheckBox = $(element);
                      $(element).on('change', function (event) {
                          var checked = event.args.checked;
                          if (checked == null || false) return;
                          var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
                          $("#jqxgrid").jqxGrid('beginupdate');

                          if (checked) {
                              $("#jqxgrid").jqxGrid('selectallrows');
                          }
                          else if (checked == false) {
                              $("#jqxgrid").jqxGrid('clearselection');
                          }

                          for (var i = 0; i < rowscount; i++) {
                              $("#jqxgrid").jqxGrid('setcellvalue', i, 'issel', event.args.checked);
                          }

                          $("#jqxgrid").jqxGrid('endupdate');
                      });
                      return true;
                  }
              },
            { text: 'ID', dataField: 'ID', hidden: "hides" },
              { text: '备注1', dataField: 'statusremark', hidden: "hides" },
              { text: '单位名称', dataField: 'dwname' },
              { text: '项目期别', dataField: 'Remark1' },
              { text: '计划科目', dataField: 'FLName' },
              { text: '合同编号', dataField: 'htbh' },
              { text: '对方单位或个人', dataField: 'dfdw' },
              { text: '合同内容', dataField: 'htnr' },
              { text: '第一月', dataField: 'je1' },
              { text: '第一月描述', dataField: 'je1dec' },
              { text: '付款一览表金额', dataField: 'ylbje' },
              { text: '收款单位', dataField: 'skdw' },
              { text: '收款开户行', dataField: 'skkhh' },
              { text: '收款开户联行号', dataField: 'khhlhh' },
              { text: '收款账号', dataField: 'skzh' },
              { text: '执行金额', dataField: 'zxje', editable: false },

              {
                  text: '计划状态', dataField: 'status', filterable: false, editable: false,
                  groupable: false, draggable: false, resizable: false, width: 100, cellsrenderer: function (row, column, value) {
                      var data = $('#jqxgrid').jqxGrid('getrowdata', row);
                      var desc = ComFunJS.jhzcstatus(data.status, data);

                      var html = "";
                      //html = '<a href="#" onclick="tempindex.showzt(\'' + row + '\')"><p class="text-error" style="display: inline;font-size: 16px;    color: blue;">' + desc + '</p></a>';
                      var returns = ' <div style="overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 12px;">' + desc + '</div>';
                      return returns;
                  }
              }



        ]
    };

    var tempindex = avalon.define({
        $id: "LIST",
        tmpListData: [],
        JHDATA: {},
        selids: "",
        datatype: "8",
        SelectDataType: function (type) {
            tempindex.datatype = type;
            tempindex.GetLIST();

        },
        InitWigetData: function (obj) {
            tempindex.JHDATA = model.JHDATA;
            //显示的列名
            tempindex.GetLIST();
            $(".tab-box li").each(function (i) {
                $(this).click(function () {
                    $(this).addClass("active").siblings().removeClass("active");
                    $("#wrap>div:eq(" + i + ")").show().siblings().hide();
                });
            });

        },
        getcheckid: function () {
            tempindex.selids = "";
            var rowindexes = $('#jqxgrid').jqxGrid('getselectedrowindexes');
            for (var i = 0; i < rowindexes.length; i++) {
                var data = $('#jqxgrid').jqxGrid('getrowdata', rowindexes[i]);
                if (i == 0) {
                    tempindex.selids = data.ID;
                } else {
                    tempindex.selids = tempindex.selids + "," + data.ID;

                }
            }
            return tempindex.selids;
        },
        jhzxmx: function () {
            if (!tempindex.getcheckid()) {
                ComFunJS.winwarning("请至少选择一条数据进行操作！");
                return;
            };
            if (tempindex.selids.toString().split(",").length > 1) {
                ComFunJS.winwarning("只能选择一条数据进行操作！");
                return;
            };
            ComFunJS.winviewform("/ViewV5/AppPage/ZCZX/ZCMX.html?JHID=" + tempindex.JHDATA.ID + "&MXID=" + tempindex.selids + "&r=" + Math.random(), "计划支付");

        },

        GetLIST: function () {
            try {
                $('#jqxgrid').jqxGrid('destroy');

            } catch (e) {

            }
            $(".grid").append('<div id="jqxgrid" class="jqxgrid" style="border-right:0;border-left:0;"></div>')
            $.getJSON('/API/VIEWAPI.ashx?Action=ZCZX_GETZXMXLIST', { P1: tempindex.JHDATA.ID, P2: tempindex.datatype }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    for (var i = 0; i < resultData.Result.length; i++) {
                        resultData.Result[i].issel = "false";
                    }
                    ComFunJS.inithighgrid(goption, resultData.Result, "jqxgrid");
                    tempindex.tmpListData = resultData.Result;
                }
            })
        }
    }) //@ sourceURL=JHSR_MXLIST.js;
</script>
